package com.company;

import java.util.Random;
import java.util.HashMap;
import java.util.Map;

import com.company.json.Json;
import net.sf.json.JSONException;
import net.sf.json.JSONObject;

/**
 * Created by v on 17-4-10.
 */
public class Main {
    public static void main(String[] args) throws JSONException {
        String json = "{'name':'reiz'}";
        JSONObject jsonObj = new JSONObject();
        String name = jsonObj.getString("name");

        System.out.println(jsonObj);

        jsonObj.put("initial", name.substring(0, 1).toUpperCase());

        String[] likes = new String[]{"JavaScript", "Skiing", "Apple Pie"};
        jsonObj.put("likes", likes);

        System.out.println(jsonObj);

        Map<String, String> ingredients = new HashMap<String, String>();
        ingredients.put("apples", "3kg");
        ingredients.put("sugar", "1kg");
        ingredients.put("pastry", "2.4kg");
        ingredients.put("bestEaten", "outdoors");
        jsonObj.put("ingredients", ingredients);
        System.out.println(jsonObj);
    }
}
